package com.longteng.lesson.po;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.util.Date;

/**
 * Created by Administrator
 * DATE : 2018/5/13
 * TIME : 10:42
 * PROJECT : java-lesson
 * PACKAGE : com.longteng.lesson
 *
 * @author <a href="mailto:taki@qq.com">Administrator</a>
 */
@Data
public class User {
    private int userId;
    @NotEmpty(message = "用户名不能为空!")@NotNull(message = "用户名不能为空!")
    private String userName;
    @NotNull
    private int sex;
    private String codeType;
    private String address;
    @NotEmpty(message = "密码不能为空!")
    @Size(max = 12,min = 8,message = "密码长度要在8到12位之间")
    private String password;
    private String city;
    @NotNull(message = "生日不能为空!")
    @Past(message = "出生日期要在当前日期之前!")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date  birthday;


    private Hobby hobby;

    @Override
    public String toString() {
        return "User{" +
                "userName='" + userName + '\'' +
                ", sex=" + sex +
                ", codeType='" + codeType + '\'' +
                ", address='" + address + '\'' +
                ", password='" + password + '\'' +
                ", city='" + city + '\'' +
                ", hobby=" + hobby +
                '}';
    }
}
